/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { createContext } from 'react';
import type { Dispatch, SetStateAction } from 'react';
import type { ImageSourcePropType } from 'react-native';

export type ModeType = 'photo' | 'video';

export type CameraPosition = 'front' | 'back';

/** 上下文props */
export type ContextProps = {
  /** 模式- 拍照 | 录像 */
  mode: ModeType;
  /** 切换模式 */
  setMode: Dispatch<SetStateAction<ModeType>>;
  /** 相机位置- 后 | 前 */
  position: CameraPosition;
  /** 切换相机位置 */
  setPosition: Dispatch<SetStateAction<CameraPosition>>;
  /** 是否正在录像 */
  isRecording: boolean;
  /** 设置是否正在录像 */
  setIsRecording: Dispatch<SetStateAction<boolean>>;
  /** 相机生成临时文件路径 */
  path: ImageSourcePropType;
  /** 设置相机生成临时文件路径 */
  setPath: Dispatch<SetStateAction<ImageSourcePropType>>;
  /** 可用媒体类型 */
  mediaType: ModeType;
  /** 设置媒体类型 */
  setMediaType: Dispatch<SetStateAction<ModeType>>;
  /** 设置是否开启录像 */
  isOpenVideo: boolean;
  setIsOpenVideo: (isOpen: boolean) => void;
  /** 设置是否开启拍照 */
  isOpenPhoto: boolean;
  setIsOpenPhoto: (isOpen: boolean) => void;
    /** 设置焦距 */
  zoom: number;
  setZoom: (zoomSize: number) => void;
};

const Context = createContext<ContextProps>({} as ContextProps);

export default Context;
